﻿using System;
using fastCSharp;

namespace diantou.web.management
{
    /// <summary>
    /// 问题测试数据
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPage = false, IsPool = true)]
    partial class problemDataEdit : permissionView<problemDataEdit>
    {
        /// <summary>
        /// 问题信息
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private diantou.dataAccess.problem problem;
        /// <summary>
        /// 测试数据集合
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private diantou.dataAccess.problemTestData[] testDatas;
        /// <summary>
        /// 当前编辑数据
        /// </summary>
        private diantou.dataAccess.problemTestData testData;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="problemId"></param>
        /// <returns></returns>
        private bool loadView(int problemId)
        {
            problem = diantou.dataAccess.clientCache.Problem[problemId];
            if (problem != null && currentUser.IsOnlineJudgeEditor(problem))
            {
                testDatas = diantou.dataAccess.tcpCall.problemTestData.Get(problemId);
                testDatas = testDatas.getSort(value => value.TestId);
                testData = new dataAccess.problemTestData { TestId = testDatas.maxKey(value => value.TestId, 0) + 1 };
                return true;
            }
            AjaxResponse(webConfig.NotFound404);
            return false;
        }
    }
}